using System;
using System.Collections.Generic;
using System.Data.Linq.Mapping;
using InfoTech.Core.Data.Attributes;
using InfoTech.Core.Data.Dataable;
using InfoTech.Core.Data.Persistence;
using InfoTech.Utilities.Generic;

namespace InfoTech.LanTranh.MucVu.Bussiness
{
	[Serializable]
	[ExtraTable(Name = "BITICH", Schema="dbo")]
	[Table(Name = "[dbo].[BITICH]")]
	public partial class BITICH : ObjPersistence, IDeleteable, IUpdateable, IInsertable, ISelectable, IDeleteablebyId, IUpdateablebyId, ISelectablebyId
	{

		#region Fields

		private System.Int32 _mabitich;

		private System.String _tenbitich;

		private IEnumerable<SOBITICH> _ref_sobitich;

		#endregion

		#region Properties

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = false)]
		[Column(Name = "MABITICH", DbType = "int", IsPrimaryKey = true, CanBeNull = false)]
		public System.Int32 MABITICH
		{
			get
			{
				return _mabitich;
			}
			set
			{
				OnChanged(this, "MABITICH");
				_mabitich = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 50, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TENBITICH", DbType = "nvarchar(50)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TENBITICH
		{
			get
			{
				return _tenbitich;
			}
			set
			{
				OnChanged(this, "TENBITICH");
				_tenbitich = value;
			}
		}

		public IEnumerable<SOBITICH> REF_SOBITICH
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_sobitich == null))
					InfoTech.Core.Data.Receiver.TypeObject<SOBITICH>.Select(this, "REF_SOBITICH", new[] { new Vector<string, string>("MABITICH", "MABITICH"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_sobitich;
			}
			set
			{
				_ref_sobitich = value;
			}
		}

		#endregion

		#region Reflector

		public System.Type Reflector()
		{
			return typeof(BITICH);
		}
		public object Current
		{
			get { return this; }
		}

		#endregion

	}
}
